<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<script type="text/javascript">
	$(document).ready(function() {
		$("#editPayeeForm").validate({
			rules : {
				payeeName : {
					required : true
				},
				bankCode : {
					required : function(element) {
						return $("#chipsCode").val().replace(/\s/g, "") == "";
					}
				},
				chipsCode : {
					required : function(element) {
						return $("#bankCode").val().replace(/\s/g, "") == "";
					}
				},
				accountNumber : {
					required : true
				}
			}
		});
		
	});
</script>
<div id="editPayeeDiv">
	<form:form name="editPayeeForm" id="editPayeeForm" modelAttribute="payee">
		<form:hidden path="id" />
		<table width="100%" border="0">
			<tr class="row">
				<td class="menu-heading" colspan="3"><spring:message code="printPayee.heading" /></td>
			</tr>
			<tr class="row">
				<td class="input-field" colspan="2">
					<%@ include file="/common/messages.jsp" %>
				</td>
			</tr>
			<tr>
				<td style="vertical-align: top"><table>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.payeeName" /></td>
							<td class="input-field"><form:input path="payeeName" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="payeeName" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiarytName" /></td>
							<td class="input-field"><form:input path="beneficiarytName" cssClass="input-full-width-req" disabled="true"/></td>
							<td><form:errors path="beneficiarytName" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryAddressLine1" /></td>
							<td class="input-field"><form:input path="beneficiaryAddressLine1" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="beneficiaryAddressLine1" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryAddressLine2" /></td>
							<td class="input-field"><form:input path="beneficiaryAddressLine2" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="beneficiaryAddressLine2" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryCity" /></td>
							<td class="input-field"><form:input path="beneficiaryCity" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="beneficiaryCity" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryState" /></td>
							<td class="input-field"><form:input path="beneficiaryState" cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryState" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryZipCode" /></td>
							<td class="input-field"><form:input path="beneficiaryZipCode" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="beneficiaryZipCode" cssClass="error" /></td>
						</tr>
						<%--
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryCountry" /></td>
							<td class="input-field"><form:select path="beneficiaryCountry.id">
									<form:options items="${countryList}" itemValue="id" itemLabel="displayName" />
								</form:select></td>
							<td><form:errors path="beneficiaryCountry.id" cssClass="error" /></td>
						</tr>
						 --%>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.beneficiaryPhoneNumber" /></td>
							<td class="input-field"><form:input path="beneficiaryPhoneNumber" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="beneficiaryPhoneNumber" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankName" /></td>
							<td class="input-field"><form:input path="bankName" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="bankName" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankCode" /></td>
							<td class="input-field"><form:input path="bankCode" cssClass="input-full-width-req" disabled="true"/></td>
							<td><form:errors path="bankCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.chipsCode" /></td>
							<td class="input-field"><form:input path="chipsCode" cssClass="input-full-width-req" disabled="true"/></td>
							<td><form:errors path="chipsCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.accountNumber" /></td>
							<td class="input-field"><form:input path="accountNumber" cssClass="input-full-width-req" disabled="true"/></td>
							<td><form:errors path="accountNumber" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankAddressLine1" /></td>
							<td class="input-field"><form:input path="bankAddressLine1" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="bankAddressLine1" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankAddressLine2" /></td>
							<td class="input-field"><form:input path="bankAddressLine2" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="bankAddressLine2" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankCity" /></td>
							<td class="input-field"><form:input path="bankCity" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="bankCity" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankState" /></td>
							<td class="input-field"><form:input path="bankState" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="bankState" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankZipCode" /></td>
							<td class="input-field"><form:input path="bankZipCode" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="bankZipCode" cssClass="error" /></td>
						</tr>
						<%--					
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.bankCountry" /></td>
							<td class="input-field"><form:input path="bankCountry" cssClass="input-full-width" /></td>
							<td><form:errors path="bankCountry" cssClass="error" /></td>
						</tr>
						 --%>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.intermediaryBank" /></td>
							<td class="input-field"><form:input path="intermediaryBank" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="intermediaryBank" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.intermediaryBankCode" /></td>
							<td class="input-field"><form:input path="intermediaryBankCode" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="intermediaryBankCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message code="editPayee.label.specialInstructions" /></td>
							<td class="input-field"><form:input path="specialInstructions" cssClass="input-full-width" disabled="true"/></td>
							<td><form:errors path="specialInstructions" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label">&nbsp;</td>
							<td>&nbsp;</td>
						</tr>
					</table></td>
				<td>
					<%-- <table>
						<tr>
							<td>Bank Wire Information:</td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiarytName" /></td>
							<td class="input-field"><form:input path="beneficiarytName"
									cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiarytName" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryAddressLine1" /></td>
							<td class="input-field"><form:input
									path="beneficiaryAddressLine1" cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryAddressLine1"
									cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryAddressLine2" /></td>
							<td class="input-field"><form:input
									path="beneficiaryAddressLine2" cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryAddressLine2"
									cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryCity" /></td>
							<td class="input-field"><form:input path="beneficiaryCity"
									cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryCity" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryState" /></td>
							<td class="input-field"><form:input path="beneficiaryState"
									cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryState" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryZipCode" /></td>
							<td class="input-field"><form:input
									path="beneficiaryZipCode" cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryZipCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryCountry" /></td>
							<td class="input-field"><form:select
									path="beneficiaryCountry.id">
									<form:options items="${countryList}" itemValue="id"
										itemLabel="displayName" />
								</form:select></td>
							<td><form:errors path="beneficiaryCountry.id"
									cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.beneficiaryPhoneNumber" /></td>
							<td class="input-field"><form:input
									path="beneficiaryPhoneNumber" cssClass="input-full-width" /></td>
							<td><form:errors path="beneficiaryPhoneNumber"
									cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankName" /></td>
							<td class="input-field"><form:input path="bankName"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankName" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankCode" /></td>
							<td class="input-field"><form:input path="bankCode"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.chipsCode" /></td>
							<td class="input-field"><form:input path="chipsCode"
									cssClass="input-full-width" /></td>
							<td><form:errors path="chipsCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.accountNumber" /></td>
							<td class="input-field"><form:input path="accountNumber"
									cssClass="input-full-width" /></td>
							<td><form:errors path="accountNumber" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankAddressLine1" /></td>
							<td class="input-field"><form:input path="bankAddressLine1"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankAddressLine1" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankAddressLine2" /></td>
							<td class="input-field"><form:input path="bankAddressLine2"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankAddressLine2" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankCity" /></td>
							<td class="input-field"><form:input path="bankCity"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankCity" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankState" /></td>
							<td class="input-field"><form:input path="bankState"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankState" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankZipCode" /></td>
							<td class="input-field"><form:input path="bankZipCode"
									cssClass="input-full-width" /></td>
							<td><form:errors path="bankZipCode" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.bankCountry" /></td>
							<td class="input-field"><form:select path="bankCountry.id">
									<form:options items="${countryList}" itemValue="id"
										itemLabel="displayName" />
								</form:select></td>
							<td><form:errors path="bankCountry.id" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.intermediaryBank" /></td>
							<td class="input-field"><form:input path="intermediaryBank"
									cssClass="input-full-width" /></td>
							<td><form:errors path="intermediaryBank" cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.intermediaryBankCode" /></td>
							<td class="input-field"><form:input
									path="intermediaryBankCode" cssClass="input-full-width" /></td>
							<td><form:errors path="intermediaryBankCode"
									cssClass="error" /></td>
						</tr>
						<tr class="row">
							<td class="label"><spring:message
									code="editPayee.label.specialInstructions" /></td>
							<td class="input-field"><form:input
									path="specialInstructions" cssClass="input-full-width" /></td>
							<td><form:errors path="specialInstructions" cssClass="error" /></td>
						</tr>
					</table> --%>
				</td>
			</tr>
		</table>
	</form:form>
	<script type="text/javascript">
		$(document).ready(function() {
			$('table.tablesorter').tablesorter({
				widgets : [ 'zebra' ],
				sortList : [ [ 0, 0 ] ],
				headers : {
					3 : {
						sorter : false
					},
					4 : {
						sorter : false
					}
				}
			});

			$('.edit-payeeaward-link').click(function() {
				loadDiv('content', 'showEditPayeeaward.do?id=' + $(this).attr('payeeawardId'));
			});
		});
	</script>
	<div id="payeeawardListDiv" class="hastable">
		<%-- <table class="tablesorter">
		<thead>
			<tr>
				<th><spring:message code="payeeawardlist.table.heading.payeeAwardNumber"/></th>
				<th><spring:message code="payeeawardlist.table.heading.payeeAwardDesc"/></th>
				<th><spring:message code="payeeawardlist.table.heading.startDate"/></th>
				<th><spring:message code="payeeawardlist.table.heading.city"/></th>
				<th><spring:message code="payeeawardlist.table.heading.state"/></th>							
				<th><spring:message code="payeeawardlist.table.heading.viewAward"/></th>
				<th><spring:message code="payeeawardlist.table.heading.edit"/></th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${payee.payeeawards}" var="payeeaward">
				<tr>
					<td>${payeeaward.payeeAwardNumber}</td>
					<td>${payeeaward.payeeAwardDesc}</td>
					<td>${payeeaward.startDate}</td>
					<td>${payeeaward.city}</td>
					<td>${payeeaward.state}</td>				
					<td><a href="javascript://" class="view-awards-link" payeeawardId="${payeeaward.id}"><spring:message code="payeeawardlist.table.link.viewAward"/></a></td>
					<td><a href="javascript://" class="edit-payeeaward-link" payeeawardId="${payeeaward.id}"><spring:message code="payeeawardlist.table.link.edit"/></a></td>
				</tr>
			</c:forEach>
		</tbody>
	</table> --%>
		<div id="payeeawardListPager"></div>
	</div>
</div>
